public void WhippedCreamClass_FullDescriptionProperty_ShouldExists() { // Arrange var coffeeMock = new Mock <ICoffee>(); // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj, Has.Property("FullDescription")); }
public void WhippedCreamClass_Countructor_ShouldInitializeObjectCorrectly() { // Arrange var coffeeMock = new Mock <ICoffee>(); // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj, Is.InstanceOf <WhippedCream>()); }
public void WhippedCreamClass_ShouldImplementICoffeeInterface() { // Arrange var coffeeMock = new Mock <ICoffee>(); // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj, Is.InstanceOf <ICoffee>()); }
public static void Run() { Drink drink = new Expresso(); System.Console.WriteLine($"{drink.GetDescription()}: {drink.Price()} zł"); drink = new Chocolate(drink); drink = new Chocolate(drink); drink = new WhippedCream(drink); System.Console.WriteLine($"{drink.GetDescription()}: {drink.Price()} zł"); }
public static void Execute() { ConsoleExtension.WriteSeparator("Pancake example"); Pancake pancake = new BigPancake(); pancake = new WhippedCream(pancake); pancake = new MixedBerries(pancake); pancake = new MappleSyrup(pancake); Console.WriteLine(pancake.GetDescriptionAndAddIns()); Console.WriteLine("{0:C2}", pancake.CalculatePrice()); }
public void WhippedCreamClass_IdProperty_ShouldReturnCorrectId() { // Arrange var coffeeMock = new Mock <ICoffee>(); coffeeMock.Setup(p => p.Id).Returns("Test"); var expectedId = "WIC5"; // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj, Has.Property("Id").Contains(expectedId)); }
static void Main(string[] args) { // client code Cake cake1 = new ButterCake(); cake1 = new ChocolateDrip(cake1); cake1 = new FreshFruit(cake1); System.Console.WriteLine(cake1.get_description() + ": $" + cake1.cost()); Cake cake2 = new SpongeCake(); cake2 = new WhippedCream(cake2); cake2 = new Candies(cake2); System.Console.WriteLine(cake2.get_description() + ": $" + cake2.cost()); }
public void WhippedCreamClass_FullDescriptionProperty_ShouldReturnCorrectFullDescription() { // Arrange var coffeeDescription = "Coffee Full Description"; var coffeeMock = new Mock <ICoffee>(); coffeeMock.Setup(x => x.FullDescription).Returns(coffeeDescription); var condimentDescription = "Whipped Cream"; var expectedFullDescription = coffeeDescription + " " + condimentDescription; // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj.FullDescription, Is.EqualTo(expectedFullDescription)); }
public void WhippedCreamClass_CostMethod_ShouldReturnCorrectPrice() { // Arrange var coffeePrice = 2.00m; var coffeeMock = new Mock <ICoffee>(); coffeeMock.Setup(x => x.Cost()).Returns(coffeePrice); var condimentPrice = 0.85m; var expectedCost = coffeePrice + condimentPrice; // Act var obj = new WhippedCream(coffeeMock.Object); // Assert Assert.That(obj.Cost(), Is.EqualTo(expectedCost)); }
private static ObjectContext GetContext(WhippedCream.EntityFrameworkDataLayer.IEntityFrameworkInitializerMap map) { var initializer = map.GetInitializer<IUserRepository>(); ObjectContext result = new ObjectContext(initializer.GenerateConnectionString()); result.DefaultContainerName = initializer.DefaultContainerName; return result; }
public UserRepository(WhippedCream.EntityFrameworkDataLayer.IEntityFrameworkInitializerMap map) : base(GetContext(map), true) { this.Configuration.ProxyCreationEnabled = false; }
public WhippedCreamDecorator(ICoffee coffee) { this.whippedCream = new WhippedCream(); this.Coffee = coffee; }