This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.IndexOutOfRangeException was unhandled | |
Message=Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader. | |
Source=System.CoreEx | |
StackTrace: | |
Server stack trace: | |
at System.Buffer.InternalBlockCopy(Array src, Int32 srcOffsetBytes, Array dst, Int32 dstOffsetBytes, Int32 byteCount) | |
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count) | |
at System.IO.TextWriter.WriteLine(String value) | |
at System.IO.TextWriter.SyncTextWriter.WriteLine(String value) | |
at System.Console.WriteLine(String value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void UpdatePropertyValue<T, TValue>(Expression<Func<T, TValue>> property, T fake, TValue newValue) where T : class | |
{ | |
property.Compile()(fake).Returns(newValue); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Stuff | |
{ | |
#region Using Directives | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq.Expressions; | |
using Moq; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Offset_WhenLogOffsetChanges_RaisesPropertyChanged() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
test.AssertThatChangeNotificationIsRaisedBy(x => x.Offset). | |
When(() => _log.PropertyChanged += Raise.With(new PropertyChangedEventArgs("Offset")).Now); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Offset_WhenLogOffsetChanges_RaisesPropertyChanged() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
test.AssertThatChangeNotificationIsRaisedBy(x => x.Offset). | |
When(() => _log.PropertyChanged += Raise.Event<PropertyChangedEventHandler>(this, | |
new PropertyChangedEventArgs("Offset"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Offset_WhenLogOffsetChanges_RaisesPropertyChanged() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
test.AssertThatChangeNotificationIsRaisedBy(x => x.Offset). | |
When(() => Mock.Get(_log).Raise(x => x.PropertyChanged += null, | |
new PropertyChangedEventArgs("Offset"))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Initialize_Always_InitializesParserPresenter() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
_parserPresenter.Received().Initialize(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Initialize_Always_InitializesParserPresenter() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
A.CallTo(() => _parserPresenter.Initialize()).MustHaveHappened(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Initialize_Always_InitializesParserPresenter() | |
{ | |
LogPresenter test = BuildTestSubject(); | |
test.Initialize(); | |
Mock.Get(_parserPresenter).Verify(x => x.Initialize()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFixture | |
{ | |
private readonly ICloseLogFileCommand _closeCommand = A.Fake<ICloseLogFileCommand>(); | |
private readonly ILog _log = A.Fake<ILog>(); | |
public MyFixture() | |
{ | |
A.CallTo(() => _log.Name).Returns(@"C:\Path\To\File.log"); | |
A.CallTo(() => _log.Count).Returns(42); |