public void AnalogousController3() { DbContextOptions <ColorWheelDbContext> options3 = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext dbContext3 = new ColorWheelDbContext(options3)) { Color color = new Color(); color.ColorName = "Yellow"; Analogous analogous = new Analogous(); analogous.ColorOneID = 9; analogous.ColorTwoID = 10; analogous.ColorThreeID = 8; dbContext3.Add(color); dbContext3.Add(analogous); dbContext3.SaveChanges(); var expected = "Yellow"; var controller = new AnalogousController(dbContext3); var actionResult = controller.Get(expected); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void TriadicController3() { DbContextOptions <ColorWheelDbContext> options15 = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext dbContext15 = new ColorWheelDbContext(options15)) { Color color = new Color(); color.ColorName = "Yellow-Green"; Triadic triadic = new Triadic(); triadic.ColorOneID = 1; triadic.ColorTwoID = 2; triadic.ColorThreeID = 6; dbContext15.Add(color); dbContext15.Add(triadic); dbContext15.SaveChanges(); var expected = "Yellow-Green"; var controller = new TriadicController(dbContext15); var actionResult = controller.Get(expected); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void CanReturn404StatusCode() { DbContextOptions <ColorWheelDbContext> moreFakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(moreFakeOptions)) { Color moreYellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color moreYellowOrange = new Color { ID = 12, ColorName = "Yellow-Orange", HexCode = "#FCCC1A" }; Complementary moreComplementary = new Complementary(); moreComplementary.ColorOneID = 1; moreComplementary.ColorTwoID = 2; fakeDB.Add(moreYellow); fakeDB.Add(moreYellowOrange); fakeDB.Add(moreComplementary); fakeDB.SaveChanges(); var moreColor1 = "Yellow"; var moreColor2 = "Red"; var moreController = new ComplementaryController(fakeDB); var moreActionResult = moreController.Get(moreColor1, moreColor2); var notFoundResult = moreActionResult as NotFoundResult; Assert.IsType <NotFoundResult>(moreActionResult); } }
public void CanReturn200StatusCode() { DbContextOptions <ColorWheelDbContext> fakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(fakeOptions)) { Color yellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color violet = new Color { ID = 7, ColorName = "Violet", HexCode = "#8601AF" }; Complementary complementary = new Complementary(); complementary.ColorOneID = 1; complementary.ColorTwoID = 7; fakeDB.Add(yellow); fakeDB.Add(violet); fakeDB.Add(complementary); fakeDB.SaveChanges(); var color1 = "Yellow"; var color2 = "Violet"; var controller = new ComplementaryController(fakeDB); var actionResult = controller.Get(color1, color2); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void TetradicController3() { DbContextOptions <ColorWheelDbContext> options12 = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext dbContext12 = new ColorWheelDbContext(options12)) { Color color = new Color(); color.ColorName = "Blue-Violet"; Tetradic tetradic = new Tetradic(); tetradic.ColorOneID = 10; tetradic.ColorTwoID = 4; tetradic.ColorThreeID = 12; tetradic.ColorFourID = 6; dbContext12.Add(color); dbContext12.Add(tetradic); dbContext12.SaveChanges(); var expected = "Blue-Violet"; var controller = new TetradicController(dbContext12); var actionResult = controller.Get(expected); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void SplitComplementaryController3() { DbContextOptions <ColorWheelDbContext> options9 = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext dbContext9 = new ColorWheelDbContext(options9)) { Color color = new Color(); color.ColorName = "Red-Violet"; SplitComplementary split = new SplitComplementary(); split.ColorOneID = 10; split.ColorTwoID = 3; split.ColorThreeID = 5; dbContext9.Add(color); dbContext9.Add(split); dbContext9.SaveChanges(); var expected = "Red-Violet"; var controller = new SplitComplementaryController(dbContext9); var actionResult = controller.Get(expected); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void CanReturn404StatusCode() { DbContextOptions <ColorWheelDbContext> moreFakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(moreFakeOptions)) { Color yellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color violet = new Color { ID = 7, ColorName = "Violet", HexCode = "#8601AF" }; Color green = new Color { ID = 3, ColorName = "Green", HexCode = "#66B032" }; Color red = new Color { ID = 9, ColorName = "Red", HexCode = "#FE2712" }; Tetradic tetradic = new Tetradic(); tetradic.ColorOneID = 1; tetradic.ColorTwoID = 7; tetradic.ColorThreeID = 3; tetradic.ColorFourID = 9; fakeDB.Add(yellow); fakeDB.Add(violet); fakeDB.Add(green); fakeDB.Add(red); fakeDB.Add(tetradic); fakeDB.SaveChanges(); var color1 = "Yellow"; var color2 = "Violet"; var color3 = "Green"; var color4 = "Orange"; var controller = new TetradicController(fakeDB); var actionResult = controller.Get(color1, color2, color3, color4); var notFoundResult = actionResult as NotFoundResult; Assert.IsType <NotFoundResult>(actionResult); } }
public void CanReturn404StatusCode() { DbContextOptions <ColorWheelDbContext> moreFakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(moreFakeOptions)) { Color yellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color blueViolet = new Color { ID = 6, ColorName = "Blue-Violet", HexCode = "#4424D6" }; Color redViolet = new Color { ID = 8, ColorName = "Red-Violet", HexCode = "#C21460" }; SplitComplementary splitComplementary = new SplitComplementary(); splitComplementary.ColorOneID = 1; splitComplementary.ColorTwoID = 6; splitComplementary.ColorThreeID = 8; fakeDB.Add(yellow); fakeDB.Add(blueViolet); fakeDB.Add(redViolet); fakeDB.Add(splitComplementary); fakeDB.SaveChanges(); var color1 = "Yellow"; var color2 = "Blue-Violet"; var color3 = "Red"; var controller = new SplitComplementaryController(fakeDB); var moreActionResult = controller.Get(color1, color2, color3); var notFoundResult = moreActionResult as NotFoundResult; Assert.IsType <NotFoundResult>(moreActionResult); } }
public void CanReturn404StatusCode() { DbContextOptions <ColorWheelDbContext> moreFakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(moreFakeOptions)) { Color yellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color blue = new Color { ID = 5, ColorName = "Blue", HexCode = "#0247FE" }; Color red = new Color { ID = 9, ColorName = "Red", HexCode = "#FE2712" }; Triadic triadic = new Triadic(); triadic.ColorOneID = 1; triadic.ColorTwoID = 5; triadic.ColorThreeID = 9; fakeDB.Add(yellow); fakeDB.Add(blue); fakeDB.Add(red); fakeDB.Add(triadic); fakeDB.SaveChanges(); var color1 = "Yellow"; var color2 = "Blue-Violet"; var color3 = "Red"; var controller = new TriadicController(fakeDB); var actionResult = controller.Get(color1, color2, color3); var notFoundResult = actionResult as NotFoundResult; Assert.IsType <NotFoundResult>(actionResult); } }
public void CanReturn200StatusCode() { DbContextOptions <ColorWheelDbContext> fakeOptions = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext fakeDB = new ColorWheelDbContext(fakeOptions)) { Color yellow = new Color { ID = 1, ColorName = "Yellow", HexCode = "#FEFE33" }; Color yellowOrange = new Color { ID = 12, ColorName = "Yellow-Orange", HexCode = "#FCCC1A" }; Color yellowGreen = new Color { ID = 2, ColorName = "Yellow-Green", HexCode = "#B2D732" }; Analogous analogous = new Analogous(); analogous.ColorOneID = 1; analogous.ColorTwoID = 2; analogous.ColorThreeID = 12; fakeDB.Add(yellow); fakeDB.Add(yellowOrange); fakeDB.Add(yellowGreen); fakeDB.Add(analogous); fakeDB.SaveChanges(); var color1 = "Yellow"; var color2 = "Yellow-Orange"; var color3 = "Yellow-Green"; var controller = new AnalogousController(fakeDB); var actionResult = controller.Get(color1, color2, color3); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }
public void ComplementaryController3() { DbContextOptions <ColorWheelDbContext> options6 = new DbContextOptionsBuilder <ColorWheelDbContext>() .UseInMemoryDatabase(databaseName: "ColorWheelDbContext") .Options; using (ColorWheelDbContext dbContext6 = new ColorWheelDbContext(options6)) { Color color = new Color(); color.ColorName = "Orange"; Complementary complementary = new Complementary(); complementary.ColorOneID = 1; complementary.ColorTwoID = 4; dbContext6.Add(color); dbContext6.Add(complementary); dbContext6.SaveChanges(); var expected = "Orange"; var controller = new ComplementaryController(dbContext6); var actionResult = controller.Get(expected); var okObjectResult = actionResult as OkObjectResult; Assert.IsType <OkObjectResult>(actionResult); } }