public void ConstructWithNullEventArgs(ModelStateEventArgs eventArgs, IApplicationModel model, Exception e) { "Given the event args" .x(() => eventArgs.Should().BeNull()); "And the model state" .x(() => model.Should().BeNull()); "When constructing with null model state" .x(() => e = Record.Exception(() => new ModelStateEventArgs(model))); "Then the event args constructor should throw an exception" .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("model")); }
public void ConstructWithSuccess(ModelStateEventArgs eventArgs, IApplicationModel model, Exception e) { "Given the event args" .x(() => eventArgs.Should().BeNull()); "And the model state" .x(() => model = _mockModel.Object); "When constructing the event args" .x(() => e = Record.Exception(() => eventArgs = new ModelStateEventArgs(model))); "Then the event args constructor should succeed" .x(() => e.Should().BeNull()); "And the model state should be available" .x(() => eventArgs.Model.Should().NotBeNull().And.BeSameAs(model)); }