public void ANestedListWithoutExplicitTypeShouldHaveItsTypeInferred() { // Arrange var fixtya = new Fixtya(); var fixtureFile = this.GetFixtureFile ("NoExplicitTypes.yaml"); // Act fixtya.Use(fixtureFile); var result = fixtya.Get<Product> ("Biscuits"); // Assert Assert.IsNotNull(result); Assert.IsNotNull(result.Reviews); }
public void TestCase() { // Arrange var fixtya = new Fixtya(); fixtya.Use(@"Fixtures/ShoppingBasket.yaml"); var shoppingBasket = fixtya.Get<ShoppingBasket>("Test"); CostCalculator calculator = new CostCalculator(shoppingBasket); var expected = 13.29M; decimal actual = 0; // Act actual = calculator.Calculate(); // Assert Assert.AreEqual (expected, actual); }
public void AFixtureWithNestedStructureShouldBePopulated() { var fixtureFileName = "NestedStructures.yaml"; var fixtureFile = this.GetFixtureFile(fixtureFileName); var fixtya = new Fixtya(); Product fixtureInstance = null; // Act fixtya.Use(fixtureFile); fixtureInstance = fixtya.Get<Product>("Biscuits"); // Assert Assert.IsNotNull(fixtureInstance.Related); Assert.AreEqual(2, fixtureInstance.Related.Count); Assert.AreEqual("Rich Tea", fixtureInstance.Related[0].Name); Assert.AreEqual("Custard Creams", fixtureInstance.Related[1].Name); Assert.AreEqual("Ginger Nuts", fixtureInstance.Name); }
public void ATypeWithPrivatePropertiesShouldStillBePopulated() { // Arrange var fixtureFileName = "TypeWithPrivateProperties.yaml"; var fixtureFile = this.GetFixtureFile(fixtureFileName); var fixtya = new Fixtya(); ProductWithPrivateProperties fixtureInstance = null; // Act fixtya.Use(fixtureFile); fixtureInstance = fixtya.Get<ProductWithPrivateProperties>("Biscuits"); // Assert Assert.IsNotNull(fixtureInstance); Assert.AreEqual("Ginger Nuts", fixtureInstance.Name); Assert.IsNotNull(fixtureInstance.RelatedProducts); }
public void TwoProperties() { var fixtureFileName = "TwoSimpleTypedFixtures.yaml"; var fixtureFile = this.GetFixtureFile(fixtureFileName); var fixtya = new Fixtya(); Product fixtureInstance = null; // Act fixtya.Use(fixtureFile); fixtureInstance = fixtya.Get<Product>("Biscuits"); // Assert Assert.IsNotNull(fixtureInstance); Assert.AreEqual("Ginger Nuts", fixtureInstance.Name); Assert.AreEqual(2.99d, fixtureInstance.Price); }
public void TheFixtyaInstanceShouldBeAbleToRetrieveTheFixtureObjectByItsLabel() { // Arrange var fixtureFileName = "SingleSimpleTypedFixture.yaml"; var fixtureFile = this.GetFixtureFile(fixtureFileName); var fixtya = new Fixtya(); Product fixtureInstance = null; // Act fixtya.Use(fixtureFile); fixtureInstance = fixtya.Get<Product>("Biscuits"); // Assert Assert.IsNotNull(fixtureInstance); Assert.AreEqual("Ginger Nuts", fixtureInstance.Name); }