public void InstanceIsNotAssignableToTypeReference() { ModelBase act = new ModelDerived(); Type t = typeof(IModel); // MSTest MSTestAssert.IsNotInstanceOfType(act, t, "Some context"); // Assert.IsNotInstanceOfType failed. Wrong Type:<IModel>. Actual type:<ModelDerived>. Some context // NUnit Assert.That(act, Is.Not.InstanceOf(t), () => "Some context"); // Some context // Expected: not instance of <IModel> // But was: <ModelDerived> // XUnit does not support this case. // Fluent act.Should().NotBeAssignableTo(t, "SOME REASONS"); // Expected act to not be assignable to IModel because SOME REASONS, but ModelDerived is. // Shouldly act.ShouldNotBeAssignableTo(t, "Some context"); // act // should not be assignable to // IModel // but was // ModelDerived (63566392) // // Additional Info: // Some context }
public void InstanceIsNotAssignableToStaticType() { ModelBase act = new ModelDerived(); // MSTest does not support this case. // NUnit Assert.That(act, Is.Not.InstanceOf <IModel>(), () => "Some context"); // Some context // Expected: not instance of <IModel> // But was: <ModelDerived> // XUnit does not support this case. // Fluent act.Should().NotBeAssignableTo <IModel>("SOME REASONS"); // Expected act to not be assignable to IModel because SOME REASONS, but ModelDerived is. // Shouldly act.ShouldNotBeAssignableTo <IModel>("Some context"); // act // should not be assignable to // IModel // but was // ModelDerived (13726014) // // Additional Info: // Some context }