public void ExecuteDoesNotThrowsWhenSpecimenIsValidNonMockSpecimen(object validNonMockSpecimen) { // Fixture setup var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.DoesNotThrow(() => sut.Execute(validNonMockSpecimen, context)); }
public void ExecuteThrowsWhenSpecimenIsNull() { // Fixture setup var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.Execute(null, context)); }
public void ExecuteDoesNotThrowsWhenSpecimenIsValidNonMockSpecimen(object validNonMockSpecimen) { // Fixture setup var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.DoesNotThrow(() => sut.Execute(validNonMockSpecimen, context)); }
public void IgnoresNonMockSpecimens() { // Fixture setup var request = new object(); var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.DoesNotThrow(() => sut.Execute(request, context)); }
public void ExecuteDoesNotThrowsWhenSpecimenIsValidNonMockSpecimen(object validNonMockSpecimen) { // Arrange var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Act & Assert Assert.Null(Record.Exception(() => sut.Execute(validNonMockSpecimen, context))); }
public void ExecuteThrowsWhenSpecimenIsNull() { // Fixture setup var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Execute(null, context)); }
public void IgnoresNonMockSpecimens() { // Fixture setup var request = new object(); var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system and verify outcome Assert.DoesNotThrow(() => sut.Execute(request, context)); }
public void IgnoresNonMockSpecimens() { // Arrange var request = new object(); var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Act & Assert Assert.Null(Record.Exception(() => sut.Execute(request, context))); }
public void StubsProperties() { // Fixture setup const string expectedPropertyValue = "a string"; var request = new Mock<IInterfaceWithProperty>(); var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system sut.Execute(request, context); // Verify outcome request.Object.Property = expectedPropertyValue; Assert.Equal(expectedPropertyValue, request.Object.Property); }
public void DoesNotAffectMockDefaultValueSetting(DefaultValue defaultValue) { // Fixture setup var request = new Mock<IInterfaceWithProperty>() { DefaultValue = defaultValue }; var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system sut.Execute(request, context); // Verify outcome Assert.Equal(defaultValue, request.DefaultValue); }
public void StubsProperties() { // Fixture setup const string expectedPropertyValue = "a string"; var request = new Mock <IInterfaceWithProperty>(); var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system sut.Execute(request, context); // Verify outcome request.Object.Property = expectedPropertyValue; Assert.Equal(expectedPropertyValue, request.Object.Property); }
public void StubsProperties() { // Arrange const string expectedPropertyValue = "a string"; var request = new Mock <IInterfaceWithProperty>(); var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Act sut.Execute(request, context); // Assert request.Object.Property = expectedPropertyValue; Assert.Equal(expectedPropertyValue, request.Object.Property); }
public void DoesNotHangIfMockedTypeHasPropertiesWithCircularDependencies() { // Fixture setup var request = new Mock<IInterfaceWithPropertyWithCircularDependency>() { DefaultValue = DefaultValue.Mock }; var context = new Mock<ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system var task = Task.Factory.StartNew(() => sut.Execute(request, context)); bool ranToCompletion = task.Wait(1000) && task.Status == TaskStatus.RanToCompletion; // Verify outcome Assert.True(ranToCompletion); }
public void DoesNotAffectMockDefaultValueSetting(DefaultValue defaultValue) { // Arrange var request = new Mock <IInterfaceWithProperty>() { DefaultValue = defaultValue }; var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Act sut.Execute(request, context); // Assert Assert.Equal(defaultValue, request.DefaultValue); }
public void DoesNotAffectMockDefaultValueSetting(DefaultValue defaultValue) { // Fixture setup var request = new Mock <IInterfaceWithProperty>() { DefaultValue = defaultValue }; var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system sut.Execute(request, context); // Verify outcome Assert.Equal(defaultValue, request.DefaultValue); }
public void DoesNotHangIfMockedTypeHasPropertiesWithCircularDependencies() { // Fixture setup var request = new Mock <IInterfaceWithPropertyWithCircularDependency>() { DefaultValue = DefaultValue.Mock }; var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Exercise system var task = Task.Factory.StartNew(() => sut.Execute(request, context)); bool ranToCompletion = task.Wait(1000) && task.Status == TaskStatus.RanToCompletion; // Verify outcome Assert.True(ranToCompletion); }
public void DoesNotHangIfMockedTypeHasPropertiesWithCircularDependencies() { // Arrange var request = new Mock <IInterfaceWithPropertyWithCircularDependency>() { DefaultValue = DefaultValue.Mock }; var context = new Mock <ISpecimenContext>().Object; var sut = new StubPropertiesCommand(); // Act var task = Task.Run(() => sut.Execute(request, context)); bool ranToCompletion = task.Wait(5000) && task.Status == TaskStatus.RanToCompletion; // Assert Assert.True(ranToCompletion); }