public async Task TestMethodAdd_ShouldBeValidWhenSameIdExistsOnAnotherDataList() { // Arrange FakeDataRepository fakeData = new FakeDataRepository(); DataCommand cmd = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "left"); DataCommand cmd2 = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right"); DataServices dataServices = new DataServices(fakeData); // Act await dataServices.AddData(cmd); var result = await dataServices.AddData(cmd2); // Assert Assert.True(result.IsValid); }
public async Task TestMethodAdd_ShouldBeInvalidWhenRightIdIAlreadyExist() { // Arrange FakeDataRepository fakeData = new FakeDataRepository(); DataCommand cmd = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right"); DataCommand cmd2 = new DataCommand("1", "fsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfv", "right"); DataServices dataServices = new DataServices(fakeData); // Act await dataServices.AddData(cmd); var result = await dataServices.AddData(cmd2); // Assert Assert.False(result.IsValid); }
public async Task TestMethodOffSetDiff_ShouldBeValidWhenReturnsTheDiferencesOnLeftDataAndRightData() { // Arrange FakeDataRepository fakeData = new FakeDataRepository(); DataCommand cmd = new DataCommand("1", "ajdfvx", "left"); DataCommand cmd2 = new DataCommand("1", "bjdfvy", "right"); DataServices dataServices = new DataServices(fakeData); // Act await dataServices.AddData(cmd); await dataServices.AddData(cmd2); var result = dataServices.OffSetDiff("1", cmd.BodyData, cmd2.BodyData); // Assert Assert.Equal("Left Data Diff: a\0\0\0\0x and Right Data Diff: b\0\0\0\0y", result); }
public async Task TestMethodCompare_ShouldBeInvalidWhenLeftDataAndRightDataAreNotEquals() { // Arrange FakeDataRepository fakeData = new FakeDataRepository(); DataCommand cmd = new DataCommand("1", "afsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfvx", "left"); DataCommand cmd2 = new DataCommand("1", "bfsjbkjsbdkjdfbjvdfjvbdjkfdfjnvxfvlsfnvjdfnvjdfvy", "right"); DataServices dataServices = new DataServices(fakeData); // Act await dataServices.AddData(cmd); await dataServices.AddData(cmd2); var result = await dataServices.Compare("1"); // Assert Assert.False(result.IsValid); }
protected List <T> CreateMany <T>(int count) { RegisterDateTimeAssertionForType <T>(); return(FakeDataRepository.CreateMany <T>(count).ToList()); }
protected T Create <T>() { RegisterDateTimeAssertionForType <T>(); return(FakeDataRepository.Create <T>()); }
protected IEnumerable <T> CreateMany <T>(int count) { return(FakeDataRepository.CreateMany <T>(count)); }
protected T Create <T>() { return(FakeDataRepository.Create <T>()); }